package com.wwb.collect.controller;

import com.ruoyi.common.core.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.oldController.BaseController;
import com.ruoyi.common.core.web.oldPage.TableDataInfo;
import com.wwb.collect.domain.bo.ErpWwbCollectProductBo;
import com.wwb.collect.domain.vo.ErpWwbCollectProductVo;
import com.wwb.collect.request.ProductListRequest;
import com.wwb.collect.service.IWwbCollectProductService;
import com.wwb.collect.service.IWwbCommonService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description: 微唯宝供应链采集商品
 * @Author: j.zh
 * @Date: 2024/6/6
 * @return
 * @Version: 4.0.0
 * @ReferenceAddress:
**/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/wwb/collect/product")
public class WwbCollectProductController extends BaseController {

    @Resource
    IWwbCollectProductService wwbCollectProductService;

    /**
     * 查询采集商品列表
     */
    @GetMapping("/list")
    public TableDataInfo<ErpWwbCollectProductVo> list(ErpWwbCollectProductBo bo, PageQuery pageQuery) {
        return wwbCollectProductService.queryPageList(bo, pageQuery);
    }

    /**
     * 获取采集商品所有图片信息
     *
     * @param id 主键
     */
    @GetMapping("/imgMap/{id}")
    public Map<String, Object> getImgUrlById(@PathVariable Long id) {
        return wwbCollectProductService.queryImgUrlById(id);
    }

    /**
     * 获取采集商品所有图片信息
     *
     * @param map
     */
    @RepeatSubmit()
    @PostMapping("/imgMap/next")
    public Map<String, Object> queryImgUrlByIdAndNext(@RequestBody Map<String, Object> map) {
        return wwbCollectProductService.queryImgUrlByIdAndNext(map);
    }

}
